using System.Collections.Generic;
using MagicApp.Data;

namespace MagicApp.Data
{
    public class Deck : ICard
    {
        //The below list holds all cards that are
        //currently in play but are not in the deck
        //we don't want to remove them from play
        //private IList<Card> inPlayNotInDeck;
        private IList<Card> deck;
        private  int numberOfCardsInDeck;
        private string _deckName;
        public int NumberOfCardsInDeck
        {
        	set{this.numberOfCardsInDeck = value;}
        }
        public string DeckName
        {
            get { return _deckName; }
            set { _deckName = value; }
        }
        private DeckImage _image;
        public DeckImage Image
        {
            get { return _image; }
            set { this._image = value; }
        }
        public Deck()
        {
            this.deck = new List<Card>();

        }
        public Image Display()
        {
            return _image;
        }
        public void Add(Card card)
        {
            deck.Add(card);
            numberOfCardsInDeck++;
        }
        public void Remove(Card card)
        {
        	bool indexOfCard = deck.Contains(card);
        	if(indexOfCard)
        	{
        		deck.Remove(card);
        		numberOfCardsInDeck--;
        	}
        }
       
        public  int GetNumberOfCardsInDeck()
        {
            return deck.Count;
        }
        public void Clear()
        {
        	deck.Clear();
        	NumberOfCardsInDeck = 0;
        }
       
        public Card ReturnCardInDeck(int index)
       {
            Card card = (Card) deck[index];
            Remove((Card) deck[index]);
            return card;
        }
       
        
      }
    
    }
